import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
import { HydratedDocument } from 'mongoose'
import * as mongoose from 'mongoose'
import { Subject } from './subject.schema'

export type ShijuanDocument = HydratedDocument<Shijuan>

@Schema()
export class Shijuan {
  @Prop({
    required: true,
    type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Subject' }]
  })
  subjectIds: Subject[]

  @Prop({ default: '', type: Number })
  correctQuantity: number

  @Prop({ default: '', type: Number })
  score: number

  @Prop({ default: '', type: String })
  name: string
}

export const ShijuanSchema = SchemaFactory.createForClass(Shijuan)
